;(function() {
	
	window.jsPlumbDemo = {
			
		init : function() {			

//			var fillColor = "gray";
//			// notice the 'curviness' argument to this Bezier curve.  the curves on this page are far smoother
//			// than the curves on the first demo, which use the default curviness value.
//			jsPlumb.Defaults.Connector = [ "Bezier", { curviness:50 } ];
////			jsPlumb.Defaults.Connector = [ "Straight" ];
//			jsPlumb.Defaults.DragOptions = { cursor: "pointer", zIndex:2000 };
//			jsPlumb.Defaults.PaintStyle = { strokeStyle:"gray", lineWidth:1 };
//			jsPlumb.Defaults.EndpointStyle = { radius:2, fillStyle:"gray" };
//			jsPlumb.Defaults.Anchors =  [ "TopCenter", "BottomCenter" ];
//
//			// declare some common values:
//			var arrowCommon = { foldback:0.3, fillStyle:fillColor, width:7 };
//			// use three-arg spec to create two different arrows with the common values:
//			var overlays = [
//				[ "Arrow", { location:0.9 }, arrowCommon ]
//			];

//
//            jsPlumb.connect({source:"window1", target:"window2", overlays:overlays});
//			jsPlumb.connect({source:"window1", target:"window3", overlays:overlays});
//
//			jsPlumb.connect({source:"window2", target:"window4", overlays:overlays});
//			jsPlumb.connect({source:"window2", target:"window5", overlays:overlays});
//			jsPlumb.connect({source:"window2", target:"window6", overlays:overlays});
//			jsPlumb.connect({source:"window2", target:"window7", overlays:overlays});
//
//			jsPlumb.connect({source:"window3", target:"window8", overlays:overlays});
//			jsPlumb.connect({source:"window3", target:"window9", overlays:overlays});
//
//            jsPlumb.connect({source:"behavioural-top", target:"behavioural-other", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-other", target:"behavioural-other-1", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-other", target:"behavioural-other-2", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-other", target:"behavioural-other-3", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-other", target:"behavioural-other-4", overlays:overlays});
//
//            jsPlumb.connect({source:"behavioural-top", target:"behavioural-commitment", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-commitment", target:"behavioural-commitment-1", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-commitment", target:"behavioural-commitment-2", overlays:overlays});
//            jsPlumb.connect({source:"behavioural-commitment", target:"behavioural-commitment-3", overlays:overlays});


            $.each($('.window'), function(index, value){
                jsPlumb.setDraggable(value, false);
            });

            $('.window').removeClass('ui-draggable');

            $(document).ready(function() {
                setValueOfClassification();
            });

            $('.resetButton').click(function() {
                $('.selected').removeClass('selected');
                setValueOfClassification();
            })

            $('.selectable').click(function(e){

                if($(this).hasClass('selected')){
                    $(this).removeClass('selected');
                    setValueOfClassification();
                    return;
                }


                $(this).addClass('selected');
                setValueOfClassification()
            });

            function setValueOfClassification(){
                $('#classification').val('');
                var classValue = '';
                $.each($('.selected'), function(index, value){
                    classValue = classValue + $(value).data('measure-3') +','
                });
                $('#classification').val(classValue);
            }
		}
	};
	
})();